<?php

/** 
  * SHMOP共享内存操作示例
  */  
$key = 0x4337b700;  
$size = 4096;  
$shmid = @shmop_open($key, 'c', 0644, $size);  
if($shmid === FALSE){  
    exit('shmop_open error!');  
}  
  
$data = '世界，你好！我将写入很多的数据，你能罩得住么？';  
  
$length = shmop_write($shmid, pack('a*',$data), 0);  
if($length === FALSE){  
    exit('shmop_write error!');  
}
  
@shmop_close($shmid);

$shmid = @shmop_open($key, 'c', 0644, $size);
print shmop_read($shmid,0,0);

?>
